package de.chimos.property.compiler.passone;

import static org.objectweb.asm.Opcodes.ASM4;

import java.util.List;

import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.MethodVisitor;

import de.chimos.property.annotation.Property;
import de.chimos.property.compiler.Config;
import de.chimos.property.compiler.PropertyInfo;

public class PassOneMethodVisitor extends MethodVisitor {

    private final String className;
    
    private final List<PropertyInfo> properties;
    
    private final Config config;
    
	public PassOneMethodVisitor(String className, List<PropertyInfo> properties, Config config)
	{
		super(ASM4);

        this.className = className;
        
        this.properties = properties;
        
        this.config = config;
	}

	@Override
	public AnnotationVisitor visitAnnotation(String desc, boolean visible)
	{
        if(desc.equals("L"+Property.class.getName().replace('.', '/')+";"))
        {
            return new PassOneMethodAnnotationVisitor(className, properties, config);
        }
        
        return null;
	}
	
}
